package com.tristia.entity;

import java.util.Set;
import java.util.TreeSet;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import com.tristia.entity.util.ItemInfoIdComparator;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "states"
})
@XmlRootElement
public class States {

    @XmlElement(name="state", required = true)
    protected Set<State> states;

    public States() {
		super();
		// TODO Auto-generated constructor stub
	}
    
    public States(Set<State> states) {
    	setStates(states);
	}

	public Set<State> getStates() {
        if (states == null) {
        	states = new TreeSet<State>(new ItemInfoIdComparator("ACS"));
        }
        return this.states;
    }

	public void setStates(Set<State> states) {
		this.states = states;
	}

	@Override
	public String toString() {
		return (this.states != null) ? "{\"states\": " + this.states.toString() + "}" : "{states:[]}";
	}
}
